package com.example.treehole.ui.component

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@Composable
fun CustomDialog(
    title: String,
    text: String,
    onDismiss: () -> Unit,
    confirmButtonText: String = "确认"
) {
    AlertDialog(
        onDismissRequest = onDismiss,
        title = { Text(title) },
        text = {
            LazyColumn(
                modifier = Modifier.padding(8.dp)
            ) {
                item {
                    Text(text = text)
                }
            }
        },
        confirmButton = {
            TextButton(
                onClick = {onDismiss()}
            ) {
                Text(confirmButtonText)
            }
        }

    )
}